import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        Student[] students =  new Student[3];
        students[0] = new Student("zhangsan",13);
        students[1] = new Student("lisi",3);
        students[2] = new Student("wangwu",43);
        //Arrays.sort(students);
        bubbleSort(students);
        System.out.println(Arrays.toString(students));

    }
    public static void bubbleSort(Student[] student) {
        for (int i = 0; i < student.length-1; i++) {
            for (int j = 0; j < student.length - i - 1; j++) {
                if(student[j].ageComparator(student[j + 1]) > 0) {
                    Student tamp = student[j];
                    student[j] = student[j + 1];
                    student[j + 1] = tamp;
                }
            }
        }
    }
}